package cate.game.play.skill;


import cate.common.table.d.GDSkill;
import cate.common.util.XT;
import cate.game.play.config.skill.SkillCfg;
import cate.game.play.fighter.Fighter;
import cate.game.play.skill.active.*;
import cate.game.play.skill.passive.PassiveHandler;
import cate.game.play.skill.passive.awaken.*;
import cate.game.play.skill.passive.boss.三人成众PH;
import cate.game.play.skill.passive.boss.天魔咒术PH;
import cate.game.play.skill.passive.boss.魔劲激发PH;
import cate.game.play.skill.passive.exp.*;
import cate.game.play.skill.passive.fairy.*;
import cate.game.play.skill.passive.furniture.*;
import cate.game.play.skill.passive.gem.*;
import cate.game.play.skill.passive.god.*;
import cate.game.play.skill.passive.guild.*;
import cate.game.play.skill.passive.hero.*;
import cate.game.play.skill.passive.talent.*;
import easy.java.dev.note.NoteClass;
import lombok.extern.slf4j.Slf4j;


@NoteClass("技能工厂")
@Slf4j
public class SkillFactory {


    public Skill build(Fighter owner, SkillCfg cfg) {
        if (cfg == null) {
            return null;
        }
        Skill skill = new Skill();
        skill.tid = cfg.id;
        skill.owner = owner;
        skill.cfg = cfg;
        skill.setActive(createActive(cfg));
        skill.setPassive(createPassive(cfg));
        return skill;
    }


    private ActiveHandler createActive(SkillCfg cfg) {
        ActiveHandler handler = createActive(cfg.row.activeScript);
        if (handler == null) {
            return null;
        }
        handler.parse(cfg.row.activeScriptArgs);
        if (XT.isNotBlank(cfg.enhance.exActiveScriptArgs)) {
            for (String exCode : cfg.enhance.exActiveScriptArgs) {
                handler.parseExt(exCode);
            }
        }
        return handler;
    }

    private ActiveHandler createActive(String effectType) {
        if (effectType == null) {
            return null;
        }
        switch (effectType){
            case GDSkill.ActiveScript.玄音铃珠:return new 玄音铃珠AH();
            case GDSkill.ActiveScript.星罗棋布:return new 星罗棋布AH();
            case GDSkill.ActiveScript.剑斩阎罗命:return new 剑斩阎罗命AH();
            case GDSkill.ActiveScript.蓄势待发:return new 蓄势待发AH();
            case GDSkill.ActiveScript.锋芒毕露:return new 锋芒毕露AH();
            case GDSkill.ActiveScript.惊鸿剑掠:return new 惊鸿剑掠AH();
            case GDSkill.ActiveScript.游天:return new 游天AH();
            case GDSkill.ActiveScript.天威审判:return new 天威审判AH();
            case GDSkill.ActiveScript.爱意挽留:return new 爱意挽留AH();
            case GDSkill.ActiveScript.遗忘汤药:return new 遗忘汤药AH();
            case GDSkill.ActiveScript.黄泉弦音:return new 黄泉弦音AH();
            case GDSkill.ActiveScript.孟婆换血:return new 孟婆换血AH();
            case GDSkill.ActiveScript.血之威严:return new 血之威严AH();
            case GDSkill.ActiveScript.血气震荡:return new 血气震荡AH();
            case GDSkill.ActiveScript.索命鱼叉:return new 索命鱼叉AH();
            case GDSkill.ActiveScript.利刃幽镰裂:return new 利刃幽镰裂AH();
            case GDSkill.ActiveScript.冷血追魂:return new 冷血追魂AH();
            case GDSkill.ActiveScript.血性穿刺:return new 血性穿刺AH();
            case GDSkill.ActiveScript.女巫恶作剧:return new 女巫恶作剧AH();
            case GDSkill.ActiveScript.突袭:return new 突袭AH();
            case GDSkill.ActiveScript.星舞剑击:return new 星舞剑击AH();
            case GDSkill.ActiveScript.梦断魂殇:return new 梦断魂殇AH();
            case GDSkill.ActiveScript.荣耀裁决:return new 荣耀裁决AH();
            case GDSkill.ActiveScript.蚩尤魔决:return new 蚩尤魔决AH();
            case GDSkill.ActiveScript.魔火焚世:return new 魔火焚世AH();
            case GDSkill.ActiveScript.气功掌:return new 气功掌AH();
            case GDSkill.ActiveScript.将近酒:return new 将近酒AH();
            default:break;
        }
        return null;
    }

    /**
     * 构建被动 handler
     *
     * @param cfg
     * @return
     */
    private PassiveHandler createPassive(SkillCfg cfg) {
        PassiveHandler handler = createPassive(cfg.row.passiveScript);
        if (handler == null) {
            return null;
        }
        handler.parse(cfg.row.passiveScriptArgs);
        if (XT.isNotBlank(cfg.enhance.exPassiveScriptArgs)) {
            for (String code : cfg.enhance.exPassiveScriptArgs) {
                handler.parseExt(code);
            }
        }
        return handler;
    }

    private PassiveHandler createPassive(String effectType) {
        if (effectType == null) {
            return null;
        }
        switch (effectType) {
            case GDSkill.PassiveScript.连击:
                return new 连击PH();
            case GDSkill.PassiveScript.反伤:
                return new 反伤PH();
            case GDSkill.PassiveScript.敏捷:
                return new 敏捷PH();
            case GDSkill.PassiveScript.再生:
                return new 再生PH();
            case GDSkill.PassiveScript.殉道:
                return new 殉道PH();
            case GDSkill.PassiveScript.活力:
                return new 活力PH();
            case GDSkill.PassiveScript.追杀:
                return new 追杀PH();
            case GDSkill.PassiveScript.暴袭:
                return new 暴袭PH();
            case GDSkill.PassiveScript.自律:
                return new 自律PH();
            case GDSkill.PassiveScript.回魂:
                return new 回魂PH();
            case GDSkill.PassiveScript.净化:
                return new 净化PH();
            case GDSkill.PassiveScript.神疗:
                return new 神疗PH();
            case GDSkill.PassiveScript.避险:
                return new 避险PH();
            case GDSkill.PassiveScript.抗控:
                return new 抗控PH();
            case GDSkill.PassiveScript.持续受伤:
                return new 持续受伤PH();
            case GDSkill.PassiveScript.普攻抉择:
                return new 普攻抉择PH();
            case GDSkill.PassiveScript.奇偶相关:
                return new 奇偶相关PH();
            case GDSkill.PassiveScript.伤害无视:
                return new 伤害无视PH();
            case GDSkill.PassiveScript.疫病抉择:
                return new 疫病抉择PH();
            case GDSkill.PassiveScript.伤口盛宴:
                return new 伤口盛宴PH();
            case GDSkill.PassiveScript.血护之盾:
                return new 血护之盾PH();
            case GDSkill.PassiveScript.固若金汤:
                return new 固若金汤PH();
            case GDSkill.PassiveScript.生命抉择:
                return new 生命抉择PH();
            case GDSkill.PassiveScript.战法激励:
                return new 战法激励PH();
            case GDSkill.PassiveScript.源泉激励:
                return new 源泉激励PH();
            case GDSkill.PassiveScript.四羊奇偶:
                return new 四羊奇偶PH();
            case GDSkill.PassiveScript.天魔解体:
                return new 天魔解体PH();
            case GDSkill.PassiveScript.九幽阴魂:
                return new 九幽阴魂PH();
            case GDSkill.PassiveScript.乾天罡气:
                return new 乾天罡气PH();
            case GDSkill.PassiveScript.灵动九天:
                return new 灵动九天PH();
            case GDSkill.PassiveScript.妙手回春:
                return new 妙手回春PH();
            case GDSkill.PassiveScript.缴械:
                return new 缴械PH();
            case GDSkill.PassiveScript.杀意:
                return new 杀意PH();
            case GDSkill.PassiveScript.芳华:
                return new 芳华PH();
            case GDSkill.PassiveScript.金身:
                return new 金身PH();
            case GDSkill.PassiveScript.坚挺:
                return new 坚挺PH();
            case GDSkill.PassiveScript.不屈:
                return new 不屈PH();
            case GDSkill.PassiveScript.破灭:
                return new 破灭PH();
            case GDSkill.PassiveScript.摧毁:
                return new 摧毁PH();
            case GDSkill.PassiveScript.贡品:
                return new 贡品PH();
            case GDSkill.PassiveScript.集火:
                return new 集火PH();
            case GDSkill.PassiveScript.干扰:
                return new 干扰PH();
            case GDSkill.PassiveScript.罪仙:
                return new 罪仙PH();
            case GDSkill.PassiveScript.睚眦:
                return new 睚眦PH();
            case GDSkill.PassiveScript.奉献:
                return new 奉献PH();
            case GDSkill.PassiveScript.绝对零度:
                return new 绝对零度PH();
            case GDSkill.PassiveScript.沙暴送葬:
                return new 沙暴送葬PH();
            case GDSkill.PassiveScript.攻之转化:
                return new 攻之转化PH();
            case GDSkill.PassiveScript.受之转化:
                return new 受之转化PH();
            case GDSkill.PassiveScript.愈之转化:
                return new 愈之转化PH();
            case GDSkill.PassiveScript.波动狙击:
                return new 波动狙击PH();
            case GDSkill.PassiveScript.明镜止水:
                return new 明镜止水PH();
            case GDSkill.PassiveScript.混沌之力:
                return new 混沌之力PH();
            case GDSkill.PassiveScript.金刚不坏:
                return new 金刚不坏PH();
            case GDSkill.PassiveScript.自然之力:
                return new 自然之力PH();
            case GDSkill.PassiveScript.三人成众:
                return new 三人成众PH();
            case GDSkill.PassiveScript.可靠防护:
                return new 可靠防护PH();
            case GDSkill.PassiveScript.锐不可当:
                return new 锐不可当PH();
            case GDSkill.PassiveScript.枯木生花:
                return new 枯木生花PH();
            case GDSkill.PassiveScript.循环反复:
                return new 循环反复PH();
            case GDSkill.PassiveScript.生死相护:
                return new 生死相护PH();
            case GDSkill.PassiveScript.血气方刚:
                return new 血气方刚PH();
            case GDSkill.PassiveScript.同仇敌忾:
                return new 同仇敌忾PH();
            case GDSkill.PassiveScript.通真达灵:
                return new 通真达灵PH();
            case GDSkill.PassiveScript.混世魔王:
                return new 混世魔王PH();
            case GDSkill.PassiveScript.背水临渊:
                return new 背水临渊PH();
            case GDSkill.PassiveScript.浩然正气:
                return new 浩然正气PH();
            case GDSkill.PassiveScript.蚀骨锁魂:
                return new 蚀骨锁魂PH();
            case GDSkill.PassiveScript.心如止水:
                return new 心如止水PH();
            case GDSkill.PassiveScript.浴血奋战:
                return new 浴血奋战PH();
            case GDSkill.PassiveScript.厚积薄发:
                return new 厚积薄发PH();
            case GDSkill.PassiveScript.英雄觉醒:
                return new 英雄觉醒PH();
            case GDSkill.PassiveScript.对影月闪:
                return new 对影月闪PH();
            case GDSkill.PassiveScript.审判之箭:
                return new 审判之箭PH();
            case GDSkill.PassiveScript.损人利己:
                return new 损人利己PH();
            case GDSkill.PassiveScript.附香:
                return new 附香PH();
            case GDSkill.PassiveScript.烈火加身:
                return new 烈火加身PH();
            case GDSkill.PassiveScript.拈花焚魄:
                return new 拈花焚魄PH();
            case GDSkill.PassiveScript.花舞影错:
                return new 花舞影错PH();
            case GDSkill.PassiveScript.无畏战甲:
                return new 无畏战甲PH();
            case GDSkill.PassiveScript.随君终不悔:
                return new 随君终不悔PH();
            case GDSkill.PassiveScript.灵溪剑道:
                return new 灵溪剑道PH();
            case GDSkill.PassiveScript.莲华伊动:
                return new 莲华伊动PH();
            case GDSkill.PassiveScript.憋气反击:
                return new 憋气反击PH();
            case GDSkill.PassiveScript.画疆墨守:
                return new 画疆墨守PH();
            case GDSkill.PassiveScript.血战沙场:
                return new 血战沙场PH();
            case GDSkill.PassiveScript.狂沙守护:
                return new 狂沙守护PH();
            case GDSkill.PassiveScript.梨花:
                return new 梨花PH();
            case GDSkill.PassiveScript.审判恩赐:
                return new 审判恩赐PH();
            case GDSkill.PassiveScript.天使之力:
                return new 天使之力PH();
            case GDSkill.PassiveScript.超燃神炎:
                return new 超燃神炎PH();
            case GDSkill.PassiveScript.圣光指引:
                return new 圣光指引PH();
            case GDSkill.PassiveScript.圣光反馈:
                return new 圣光反馈PH();
            case GDSkill.PassiveScript.无双剑步:
                return new 无双剑步PH();
            case GDSkill.PassiveScript.圣剑压制:
                return new 圣剑压制PH();
            case GDSkill.PassiveScript.对决反击:
                return new 对决反击PH();
            case GDSkill.PassiveScript.秩序光辉:
                return new 秩序光辉PH();
            case GDSkill.PassiveScript.月漫成双:
                return new 月漫成双PH();
            case GDSkill.PassiveScript.余晖成绮:
                return new 余晖成绮PH();
            case GDSkill.PassiveScript.黄泉梦境:
                return new 黄泉梦境PH();
            case GDSkill.PassiveScript.海神惊涛:
                return new 海神惊涛PH();
            case GDSkill.PassiveScript.深海诅咒:
                return new 深海诅咒PH();
            case GDSkill.PassiveScript.狂鲨掠命:
                return new 狂鲨掠命PH();
            case GDSkill.PassiveScript.女巫禁术:
                return new 女巫禁术PH();
            case GDSkill.PassiveScript.灵魂漩涡:
                return new 灵魂漩涡PH();
            case GDSkill.PassiveScript.绝杀之刃:
                return new 绝杀之刃PH();
            case GDSkill.PassiveScript.花枪:
                return new 花枪PH();
            case GDSkill.PassiveScript.饕餮盛宴:
                return new 饕餮盛宴PH();
            case GDSkill.PassiveScript.净心九命:
                return new 净心九命PH();
            case GDSkill.PassiveScript.寸劲:
                return new 寸劲PH();
            case GDSkill.PassiveScript.蓝纹奶酪灵器:
                return new 蓝纹奶酪灵器PH();
            case GDSkill.PassiveScript.法国蜗牛灵器:
                return new 法国蜗牛灵器PH();
            case GDSkill.PassiveScript.生命之水灵器:
                return new 生命之水灵器PH();
            case GDSkill.PassiveScript.星空蛋糕灵器:
                return new 星空蛋糕灵器PH();
            case GDSkill.PassiveScript.冬阴功灵器:
                return new 冬阴功灵器PH();
            case GDSkill.PassiveScript.箭竹饭灵器:
                return new 箭竹饭灵器PH();
            case GDSkill.PassiveScript.银耳莲子羹灵器:
                return new 银耳莲子羹灵器PH();
            case GDSkill.PassiveScript.米兰意面灵器:
                return new 米兰意面灵器PH();
            case GDSkill.PassiveScript.纽伦堡香肠灵器:
                return new 纽伦堡香肠灵器PH();
            case GDSkill.PassiveScript.咖喱咖喱灵器:
                return new 咖喱咖喱灵器PH();
            case GDSkill.PassiveScript.战斧牛排灵器:
                return new 战斧牛排灵器PH();
            case GDSkill.PassiveScript.金色梦幻灵器:
                return new 金色梦幻灵器PH();
            case GDSkill.PassiveScript.至尊帝王蟹灵器:
                return new 至尊帝王蟹灵器PH();
            case GDSkill.PassiveScript.帝都烤鸭灵器:
                return new 帝都烤鸭灵器PH();
            case GDSkill.PassiveScript.伊比利亚火腿灵器:
                return new 伊比利亚火腿灵器PH();
            case GDSkill.PassiveScript.水晶马卡龙灵器:
                return new 水晶马卡龙灵器PH();
            case GDSkill.PassiveScript.卡布奇诺灵器:
                return new 卡布奇诺灵器PH();
            case GDSkill.PassiveScript.燕窝灵器:
                return new 燕窝灵器PH();
            case GDSkill.PassiveScript.孟婆灵器:
                return new 孟婆灵器PH();
            case GDSkill.PassiveScript.鲱鱼罐头灵器:
                return new 鲱鱼罐头灵器PH();
            case GDSkill.PassiveScript.黑女巫糖果灵器:
                return new 黑女巫糖果灵器PH();
            case GDSkill.PassiveScript.深海八爪鱼灵器:
                return new 深海八爪鱼灵器PH();
            case GDSkill.PassiveScript.双子灵器:
                return new 双子灵器PH();
            case GDSkill.PassiveScript.猫屎咖啡灵器:
                return new 猫屎咖啡灵器PH();
            case GDSkill.PassiveScript.酒剑仙灵器:
                return new 酒剑仙灵器PH();
            case GDSkill.PassiveScript.风神的祝福:
                return new 风神的祝福PH();
            case GDSkill.PassiveScript.邪铸壁垒:
                return new 邪铸壁垒PH();
            case GDSkill.PassiveScript.虹吸者的贪婪:
                return new 虹吸者的贪婪PH();
            case GDSkill.PassiveScript.歼灭皇冠:
                return new 歼灭皇冠PH();
            case GDSkill.PassiveScript.真理守护:
                return new 真理守护PH();
            case GDSkill.PassiveScript.荆棘屏障:
                return new 荆棘屏障PH();
            case GDSkill.PassiveScript.破魂游荡者:
                return new 破魂游荡者PH();
            case GDSkill.PassiveScript.世界树的嫩枝:
                return new 世界树的嫩枝PH();
            case GDSkill.PassiveScript.诛杀暗影之魂:
                return new 诛杀暗影之魂PH();
            case GDSkill.PassiveScript.天魔咒术:
                return new 天魔咒术PH();
            case GDSkill.PassiveScript.魔劲激发:
                return new 魔劲激发PH();
            default:
                return null;
        }
    }

}
